<template>
    <ExtForm ref="ExtForm" :formfields="formfields" @changeEventHandler="changeEventHandler"></ExtForm>
</template>
<script>

import pageSetting from '@/components/lt/codeGenerator/pageSetting'
import Vue from 'vue'
import ExtForm from '@/components/lt/codeGenerator/components/ExtForm'


export default {
    name:'ButtonAttribute',
    components:{ExtForm},
    props:{
        component:{
           type:Object,
           default:()=>{}
        },
    },
    watch:{
        
    },
    data(){
        return{
            pageSetting,
            formfields:[
                {field:'title',label:'标题',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.component.props["title"],rules: [{ required: true, message: '不能为空!' }]},
                {field:'ref',label:'ref',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.component.ref,disabled:true},
                {field:'type',label:'类型',component:pageSetting.常量.表单组件类型.下拉选择,initialValue:this.component.props["type"],options:pageSetting.数据字典.按钮类型,rules: [{ required: false, message: '不能为空!' }]},
                {field:'size',label:'大小',component:pageSetting.常量.表单组件类型.下拉选择,initialValue:this.component.props["size"],options:pageSetting.数据字典.组件大小类型,rules: [{ required: false, message: '不能为空!' }]},
                {field:'shape',label:'形状',component:pageSetting.常量.表单组件类型.下拉选择,initialValue:this.component.props["shape"],options:pageSetting.数据字典.按钮形状,rules: [{ required: false, message: '不能为空!' }]},
                {field:'icon',label:'按钮图标',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.component.props["icon"],},
                {field:'ghost',label:'按钮透明',component:pageSetting.常量.表单组件类型.开关,checkedChildren:true,unCheckedChildren:false,initialValue:this.component.props["ghost"]},
                {field:'disabled',label:'按钮失效',component:pageSetting.常量.表单组件类型.开关,checkedChildren:true,unCheckedChildren:false,initialValue:this.component.props["disabled"]},
                {field:'block',label:'宽度为父宽',component:pageSetting.常量.表单组件类型.开关,checkedChildren:true,unCheckedChildren:false,initialValue:this.component.props["block"]},
                {field:'click',label:'点击事件',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.component.props["click"],},
           
           ]
        }
    },
   
    created(){
        
    },
    methods:{
        changeEventHandler(item){
            for (const key in item) {
                Vue.set(this.component.props,key,item[key]) 
            }
        }
    }
}
</script>